<html>
<head>
<title>test_coos</title>
<meta http-equiv="Content-type" content="text/html;charset=utf-8">
<script type="text/javascript" src="../scripts/coos.js"></script>
<script type="text/javascript" src="../scripts/coos.extend.ajax.js"></script>
</head>
<body>
<div id="ajaxTestDiv">
<div>ajaxTestDiv</div>
</div>
<form action="ajax_test.action?type=post" id="post_add" name="post_add" method="post">
	<textarea name="message" id="message">cccccccccc</textarea>
</form>
<script type="text/javascript">

//test GetAjax
function testGetAjax()
{
	var url = "ajax_test.action?type=localhost";
	coos.ajax.sendGet(url,getCallback,{test1:'aaa1',test2:'bbb1'});
	//coos.ajax.sendGet(url,function(test1,test2,responseText){alert(responseText);alert(test1);},{test1:'aaa1',test2:'bbb1'});
}
function getCallback(test1,test2,responseText)
{
	var div = document.createElement("div");
	div.style.color = "red";
	div.innerHTML = "getCallback ==  " + responseText.toJson().random;
	document.getElementById("ajaxTestDiv").appendChild(div);
	//alert("getCallback responseText = " + responseText);
	//alert("getCallback message = " + responseText.toJson().message);
	//alert("getCallback test1 = " + test1);
}
//test PostAjax
function testPostAjax()
{
	var url = "ajax_test.action?type=post";
	coos.ajax.sendPost(url,postCallback,{test1:'aaa3',test2:'bbb3'},"post_add");
}
function postCallback(test1,test2,responseText)
{
	//alert("postCallback responseText = " + responseText);
	alert("postCallback message = " + responseText.toJson().message);
	alert("postCallback test1 = " + test1);
}

//test GetRemote
function testGetRemote()
{
	var url = "http://zhengdz.iap111.com:8080/coos/coos/ajax_test.action?type=remote";
	coos.ajax.sendGetRemote(url,getRemoteCallback,{test1:'aaa2',test2:'bbb2'},"remote_request");
}
function getRemoteCallback(test1,test2,responseText)
{
	var div = document.createElement("div");
	div.innerHTML = "remoteback ==  " + responseText.toJson().random;
	document.getElementById("ajaxTestDiv").appendChild(div);
	//alert("getRemoteCallback responseText = " + responseText);
	//alert("getRemoteCallback message = " + responseText.toJson().message);
	//alert("getRemoteCallback test1 = " + test1);
}
coos.onloadEvent(testGetAjax);
coos.onloadEvent(testPostAjax);
coos.onloadEvent(testGetRemote);
/*
for(var i = 0; i < 10; i++)
{
	testAjax();
	testAjax();
	testAjax();
	testAjax();
	testAjax();
	testAjax();
	testGetRemoteRequest();
	testGetRemoteRequest();
	testGetRemoteRequest();
	testGetRemoteRequest();
	testGetRemoteRequest();
	testGetRemoteRequest();
}
*/
</script>

</body>
</html>